home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _303589D0318D47B89D7F3C6B4ABD72FD < prev    next >
Encoding:
Text File  |  2003-06-23  |  6.5 KB  |  288 lines

  1. /* Comments removed - see Macromedia web site for full version of this file */
  2.  
  3. var MM_FlashSnifferURL = "wf_detectFlash.swf";
  4.  
  5.  
  6. var MM_latestPluginRevision = new Object();
  7. MM_latestPluginRevision["6.0"] = new Object();
  8. MM_latestPluginRevision["5.0"] = new Object();
  9. MM_latestPluginRevision["4.0"] = new Object();
  10. MM_latestPluginRevision["3.0"] = new Object();
  11. MM_latestPluginRevision["2.0"] = new Object();
  12.  
  13. MM_latestPluginRevision["6.0"]["Windows"] = 79;
  14. MM_latestPluginRevision["6.0"]["Macintosh"] = 79;
  15. MM_latestPluginRevision["6.0"]["Unix"] = 79;
  16.  
  17. MM_latestPluginRevision["5.0"]["Windows"] = 42;
  18. MM_latestPluginRevision["5.0"]["Macintosh"] = 41;
  19. MM_latestPluginRevision["5.0"]["Unix"] = 51;
  20.  
  21. MM_latestPluginRevision["4.0"]["Windows"] = 28;
  22. MM_latestPluginRevision["4.0"]["Macintosh"] = 27;
  23. MM_latestPluginRevision["4.0"]["Unix"] = 12;
  24.  
  25. MM_latestPluginRevision["3.0"]["Windows"] = 10;
  26. MM_latestPluginRevision["3.0"]["Macintosh"] = 10;
  27.  
  28. MM_latestPluginRevision["2.0"]["Windows"] = 11;
  29. MM_latestPluginRevision["2.0"]["Macintosh"] = 11;
  30.  
  31.  
  32. var MM_FlashControlInstalled;
  33. var MM_FlashControlVersion;
  34.  
  35. function MM_FlashInfo()
  36. {
  37.     if (navigator.plugins && navigator.plugins.length > 0)
  38.     {
  39.     this.implementation = "Plug-in";
  40.     this.autoInstallable = false;
  41.  
  42.     if (navigator.plugins["Shockwave Flash"])
  43.     {
  44.         this.installed = true;
  45.  
  46.         var words =
  47.         navigator.plugins["Shockwave Flash"].description.split(" ");
  48.  
  49.         for (var i = 0; i < words.length; ++i)
  50.         {
  51.         if (isNaN(parseInt(words[i])))
  52.         continue;
  53.  
  54.         this.version = words[i];
  55.         
  56.  
  57.         this.revision = parseInt(words[i + 1].substring(1));
  58.         }
  59.     }
  60.     else
  61.     {
  62.         this.installed = false;
  63.     }
  64.     }
  65.     else if (MM_FlashControlInstalled != null)
  66.     {
  67.     this.implementation = "ActiveX control";
  68.     this.installed = MM_FlashControlInstalled;
  69.     this.version = MM_FlashControlVersion;
  70.     this.autoInstallable = true;
  71.     }
  72.     else if (MM_FlashDetectedSelf())
  73.     {
  74.     this.installed = true;
  75.     this.implementation = "Plug-in";
  76.     this.autoInstallable = false;
  77.     }
  78.  
  79.     this.canPlay = MM_FlashCanPlay;
  80. }
  81.  
  82.  
  83. var MM_FlashPluginsPage = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";
  84.  
  85. function MM_FlashDispatch(contentVersion, requireLatestRevision,
  86.               install, overridePluginsPage,disableAutoInstall)
  87. {
  88.     var sStartContent = "alt";
  89.     if (disableAutoInstall == null)
  90.     {
  91.         alert("ERROR: MM_FlashDispatch() called with too few arguments.");
  92.         return sStartContent;
  93.     }
  94.  
  95.  
  96.     var player = new MM_FlashInfo();
  97.  
  98.     if (player.installed == null)
  99.     {
  100.         var sniffer =
  101.             "<EMBED HIDDEN=\"true\" TYPE=\"application/x-shockwave-flash\"" +
  102.             " WIDTH=\"18\" HEIGHT=\"18\"" +
  103.             " BGCOLOR=\"" + document.bgcolor + "\"" +
  104.             " SRC=\"" + MM_FlashSnifferURL +
  105.                 "?contentURL=" + contentURL + "?" +
  106.                 "&contentVersion=" + contentVersion +
  107.                 "&requireLatestRevision=" + requireLatestRevision +
  108.                 "&latestRevision=" +
  109.                     MM_FlashLatestPluginRevision(contentVersion) +
  110.                 "&upgradeURL=" + upgradeURL +
  111.                 "\"" +
  112.             " LOOP=\"false\" MENU=\"false\"" +
  113.             " PLUGINSPAGE=\"" +
  114.                 (overridePluginsPage ? installURL : MM_FlashPluginsPage) +
  115.                 "\"" +
  116.             ">" +
  117.             "</EMBED>";
  118.  
  119.         document.open();
  120.         document.write("<HTML><HEAD><TITLE>");
  121.         document.write("Checking for the Flash Player");
  122.         document.write("</TITLE></HEAD>");
  123.         document.write("<BODY BGCOLOR=\"" + document.bgcolor + "\">");
  124.         document.write(sniffer);
  125.         document.write("</BODY>");
  126.         document.write("</HTML>");
  127.         document.close();
  128.     }
  129.     else if (player.installed)
  130.     {
  131.         if (player.canPlay(contentVersion, requireLatestRevision))
  132.         {
  133.             sStartContent = "content";
  134.         }
  135.         else
  136.         {
  137.             if (disableAutoInstall)
  138.             {
  139.                 sStartContent = "upgrade";
  140.             }
  141.             else
  142.             {
  143.                 if (player.autoInstallable)
  144.                 {
  145.                     sStartContent = "auto";
  146.                 }
  147.                 else
  148.                 {
  149.                     sStartContent = "upgrade";
  150.                 }
  151.             }
  152.         }
  153.     }
  154.     else if (install)
  155.     {
  156.         if (disableAutoInstall){
  157.             sStartContent = "install";
  158.         }
  159.         else
  160.         {
  161.             if (player.autoInstallable)
  162.             {
  163.                 sStartContent = "auto";
  164.             }
  165.             else
  166.             {
  167.                 sStartContent = "install";
  168.             }
  169.         }
  170.     }
  171.     else
  172.     {
  173.         sStartContent = "alt";
  174.     }
  175.     
  176.     return sStartContent;
  177. }
  178.  
  179.  
  180. function MM_FlashRememberIfDetectedSelf(count, units)
  181. {
  182.     if (document.location.search.indexOf("?") != -1)
  183.     {
  184.     if (!count) count = 14;
  185.     if (!units) units = "days";
  186.  
  187.     var msecs = new Object();
  188.  
  189.     msecs.minute = msecs.minutes = 60000;
  190.     msecs.hour = msecs.hours = 60 * msecs.minute;
  191.     msecs.day = msecs.days = 24 * msecs.hour;
  192.  
  193.     var expires = new Date();
  194.  
  195.     expires.setTime(expires.getTime() + count * msecs[units]);
  196.  
  197.     document.cookie =
  198.         'MM_FlashDetectedSelf=true ; expires=' + expires.toGMTString();
  199.     }
  200. }
  201.  
  202.  
  203. function MM_FlashDemur(count, units)
  204. {
  205.     if (!count) count = 14;
  206.     if (!units) units = "days";
  207.  
  208.     var msecs = new Object();
  209.  
  210.     msecs.minute = msecs.minutes = 60000;
  211.     msecs.hour = msecs.hours = 60 * msecs.minute;
  212.     msecs.day = msecs.days = 24 * msecs.hour;
  213.  
  214.     var expires = new Date();
  215.  
  216.     expires.setTime(expires.getTime() + count * msecs[units]);
  217.  
  218.     document.cookie =
  219.     'MM_FlashUserDemurred=true ; expires=' + expires.toGMTString();
  220.  
  221.  
  222.     if (!MM_FlashUserDemurred())
  223.     {
  224.     alert("Your browser must accept cookies in order to " +
  225.           "save this information.  Try changing your preferences.");
  226.  
  227.     return false;
  228.     }
  229.     else
  230.     return true;
  231. }
  232.  
  233.  
  234. function MM_FlashUserDemurred()
  235. {
  236.     return (document.cookie.indexOf("MM_FlashUserDemurred") != -1);
  237. }
  238.  
  239.  
  240. function MM_FlashLatestPluginRevision(playerVersion)
  241. {
  242.     var latestRevision;
  243.     var platform;
  244.  
  245.     if (navigator.appVersion.indexOf("Win") != -1)
  246.     platform = "Windows";
  247.     else if (navigator.appVersion.indexOf("Macintosh") != -1)
  248.     platform = "Macintosh";
  249.     else if (navigator.appVersion.indexOf("X11") != -1)
  250.     platform = "Unix";
  251.  
  252.     latestRevision = MM_latestPluginRevision[playerVersion][platform];
  253.  
  254.     return latestRevision;
  255. }
  256.  
  257.  
  258. function MM_FlashCanPlay(contentVersion, requireLatestRevision)
  259. {
  260.     var canPlay;
  261.  
  262.     if (this.version)
  263.     {
  264.     canPlay = (parseInt(contentVersion) <= this.version);
  265.  
  266.     if (requireLatestRevision)
  267.     {
  268.         if (this.revision &&
  269.         this.revision < MM_FlashLatestPluginRevision(this.version))
  270.         {
  271.         canPlay = false;
  272.         }
  273.     }
  274.     }
  275.     else
  276.     {
  277.     canPlay = MM_FlashDetectedSelf();
  278.     }
  279.  
  280.     return canPlay;
  281. }
  282.  
  283.  
  284. function MM_FlashDetectedSelf()
  285. {
  286.     return (document.cookie.indexOf("MM_FlashDetectedSelf") != -1);
  287. }
  288.